var user = {
    cancel : function () {
        document.location.href = SITE_URL + 'admin/users';
    },
    
    del : function(id) {
        if(confirm('Are you sure to delete this user?'))
            document.location.href = SITE_URL + 'admin/users.users.delete/'+id;
    },
    
    del_all : function(){
        var a = document.getElementsByName('uid[]');
        conf = false;
        for(var i=0; i<a.length; i++){
            if(a[i].checked){
                conf = true;
                break;
            }
        }
        if(conf)
            if(confirm('Are you sure to delete selected users?'))
                $('frm').submit();
    },
        
    switch_image:function(sel){
        var id = sel;
        var url = SITE_URL + 'admin_ajax/image.image.display_image';
        var myAjax = new Ajax.Request(
            url,
            {method: 'post', parameters: "id="+id, onComplete: function (req){$('out').src = req.responseText;}}
        );
    }
}
